<?php
/**
 * Created by PhpStorm.
 * User: liang
 * Email:1050187159@qq.com
 * Date: 2018/8/19
 * Time: 10:59
 */
namespace Home\Controller;

class EventsController extends BaseController
{
    public function index()
    {
        $options = $this->getOptions();

        $option_id = I('get.id');
        $Option = D('Option');
        $option = $Option->where(array(
            'id' => array('eq',$option_id),
            'is_show' => array('neq',0),
            'navigator_id' => array('eq',4)
        ))->find();
        if (empty($option)) {
            $this->_empty();
        }
        $option['description'] = htmlspecialchars_decode($option['description']);

        $Event = D('Event');
        $events = $Event->order('time asc,sort asc')->select();
        foreach ($events as $key => $event) {
            $events[$key]['title'] = msubstr($event['title'], 0 , 50);
        }
        $this->assign(array(
            'nav' => $option,
            'events' => $events
        ));
        $this->display('web/Events/about');

    }
}